#include "SptMain.h"
using namespace spt;

spt::Task::Task(const char* Name, uint32 StackSize, uint32 Priority, uint32 MinPeriodMs)
{
	hdl = 0;
	step = 0;
	stackSize = StackSize;
	priority = Priority;
	minPeriodMs = MinPeriodMs;
}

void spt::Task::Start()
{
	hdl = StartTask(SptTaskLoop,this,0,stackSize,priority);
}

void spt::Task::RunLoop()
{
	while (1)
	{
		OneLoop();
	}
}

void spt::Task::OneLoop()
{
	Sleep(1000);
	DbgMsg << "This is default OneLoop,you need creat instance for OneLoop\r\n";

}
void spt::Task::SptTaskLoop(void* Ptr)
{
	Task* task = (Task*)Ptr;

	task->RunLoop();
}